
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>部门管理</title>
  <jsp:include page="../inc.jsp"></jsp:include>
</head>
<body>
<div class="easyui-layout" data-options="fit:true,border:false">
  <div data-options="region:'west'" title="" style="overflow: hidden;width:180px">
    <ul id="departmentStruct"></ul>
  </div>
  <div data-options="region:'center'" title="" style="overflow: hidden;">
  <div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'north',title:'查询条件',border:false" style="height: 80px; overflow: hidden;">
      <form id="searchForm">
        <%--<table class="table table-hover table-condensed" style="display: none;">--%>
        <div class="mTop10">
          <div class="fLeft label-handsome ">
            <label>工号:</label>
            <input id="sys-employee-gh" name=""  class="easyui-input" />

          </div>
          <div class="fLeft label-handsome ">
            <label>姓名:</label>
            <input id="sys-employee-xm" name=""  class="easyui-input"/>
          </div>

          <div class="fLeft label-handsome "  style="width:200px">
            <label>部门:</label>
            <select id="sys-employee-bm" class="easyui-combobox" name="dept" style="width:150px">
              <option value="aa">aitem1</option>
              <option>bitem2</option>
              <option>bitem3</option>
              <option>ditem4</option>
              <option>eitem5</option>
            </select>
          </div>
          <div class="fLeft label-handsome " style="width:200px">
            <label>角色:</label>
            <select id="sys-employee-js" class="easyui-combobox" name="dept" style="width:150px">
              <option value="aa">aitem1</option>
              <option>bitem2</option>
              <option>bitem3</option>
              <option>ditem4</option>
              <option>eitem5</option>
            </select>
          </div>
          <div class="fLeft">
            <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchFun();">搜索</a>
            <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_delete'" onclick="cleanFun();">清空搜索条件</a>
          </div>

        </div>
        <%--</table>--%>
      </form>
    </div>
    <div data-options="region:'center'" title="" style="overflow: hidden;">
      <table id="departmentDataGrid"></table>
    </div>
    </div>
    </div>
  <div id="toolbar" style="display: none;">
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/addPage')}">--%>
    <a onclick="addFun();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'style_add'">添加</a>
    <%--</c:if>--%>
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/editPage')}">--%>
    <a onclick="editFun();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'style_edit'">编辑</a>
    <%--</c:if>--%>
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/grantPage')}">--%>
    <a onclick="batchGrantFun();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'book_key'">批量授权</a>
    <%--</c:if>--%>
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/batchDelete')}">--%>
    <a onclick="batchDeleteFun();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'style_delete'">批量删除</a>
    <%--</c:if>--%>
  </div>

  <div id="menu" class="easyui-menu" style="width: 120px; display: none;">
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/addPage')}">--%>
    <div onclick="addFun();" data-options="iconCls:'pencil_add'">增加</div>
    <%--</c:if>--%>
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/delete')}">--%>
    <div onclick="deleteFun();" data-options="iconCls:'pencil_delete'">删除</div>
    <%--</c:if>--%>
    <%--<c:if test="${fn:contains(sessionInfo.resourceList, '/userController/editPage')}">--%>
    <div onclick="editFun();" data-options="iconCls:'pencil'">编辑</div>
    <%--</c:if>--%>
  </div>

</div>
<script type="text/javascript">
  var layout_west_tree;
  var layout_west_tree_url = '';
  <%--var sessionInfo_userId = '${sessionInfo.id}';--%>
  <%--if (sessionInfo_userId) {--%>
  layout_west_tree_url = getContextPath()+"/deptController/deptList.html";
  var departmentDataGrid;
  $(function() {
    parent.$.messager.progress('close');
      layout_west_tree = $('#departmentStruct').tree({
        url : layout_west_tree_url,
        parentField : 'pid',
        //lines : true,
        onClick : function(node) {
          if (node.attributes && node.attributes.url) {
            var url;
            if (node.attributes.url.indexOf('/') == 0) {/*如果url第一位字符是"/"，那么代表打开的是本地的资源*/
              url = '${pageContext.request.contextPath}' + node.attributes.url;
              if (url.indexOf('/druidController') == -1) {/*如果不是druid相关的控制器连接，那么进行遮罩层屏蔽*/
                parent.$.messager.progress({
                  title : '提示',
                  text : '数据处理中，请稍后....'
                });
              }
            } else {/*打开跨域资源*/
              url = node.attributes.url;
            }
            addTab({
              url : url,
              title : node.text
//						iconCls : node.iconCls
            });
          }
        },
        onBeforeLoad : function(node, param) {
          if (layout_west_tree_url) {//只有刷新页面才会执行这个方法
            parent.$.messager.progress({
              title : '提示',
              text : '数据处理中，请稍后....'
            });
          }
        },
        onLoadSuccess : function(node, data) {
          parent.$.messager.progress('close');
        }
      });

    departmentDataGrid = $('#departmentDataGrid').datagrid({
      url: '${pageContext.request.contextPath}/employee.html',
      fit: true,
      fitColumns: true,
      border: false,
      pagination: true,
      idField: 'id',
      pageSize: 3,
      pageList: [3, 20, 30, 40, 50],
      sortName: 'id',
      sortOrder: 'asc',
      checkOnSelect: false,
      selectOnCheck: false,
      nowrap: false,
      frozenColumns: [[{
        field: 'id',
        title: '编号',
        width: 150,
        checkbox: true
      }, {
        field: 'userNo',
        title: '员工编号',
        width: 80
      }, {
        field: 'userName',
        title: '账号',
        width: 80
      }, {
        field: 'userNo',
        title: '员工姓名',
        width: 80
      }]],
      columns: [[{
        field: 'userPassword',
        title: '密码',
        width: 60,
        formatter: function (value, row, index) {
          return '******';
        }
      }, {
        field: 'dept',
        title: '所属部门',
        width: 150
      }, {
        field: 'position',
        title: '职务',
        width: 150
      }, {
        field: 'sex',
        title: '性别',
        width: 150
      }, {
        field: 'status',
        title: '状态',
        width: 150
      }, {
        field: 'email',
        title: '邮件',
        width: 150
      }, {
        field: 'phone',
        title: '手机',
        width: 150
      }, {
        field: 'address',
        title: '联系地址',
        width: 150
      }
//				{
        <%--field : 'action',--%>
        <%--title : '操作',--%>
        <%--width : 100,--%>
        <%--formatter : function(value, row, index) {--%>
        <%--var str = '';--%>
        <%--if ($.canEdit) {--%>
        <%--str += $.formatString('<img onclick="editFun(\'{0}\');" src="{1}" title="编辑"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/pencil.png');--%>
        <%--}--%>
        <%--str += '&nbsp;';--%>
        <%--if ($.canGrant) {--%>
        <%--str += $.formatString('<img onclick="grantFun(\'{0}\');" src="{1}" title="授权"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/key.png');--%>
        <%--}--%>
        <%--str += '&nbsp;';--%>
        <%--if ($.canDelete) {--%>
        <%--str += $.formatString('<img onclick="deleteFun(\'{0}\');" src="{1}" title="删除"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/cancel.png');--%>
        <%--}--%>
        <%--str += '&nbsp;';--%>
        <%--if ($.canEditPwd) {--%>
        <%--str += $.formatString('<img onclick="editPwdFun(\'{0}\');" src="{1}" title="修改密码"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/lock/lock_edit.png');--%>
        <%--}--%>
        <%--return str;--%>
        <%--}--%>
        <%--}--%>
      ]],
      toolbar: '#toolbar',
      onLoadSuccess: function () {
        $('#searchForm table').show();
        parent.$.messager.progress('close');

      },
      onRowContextMenu: function (e, rowIndex, rowData) {
        e.preventDefault();
        $(this).datagrid('unselectAll').datagrid('uncheckAll');
        $(this).datagrid('selectRow', rowIndex);
        $('#menu').menu('show', {
          left: e.pageX,
          top: e.pageY
        });
      }
    });


  });
  </script>
</body>
</html>
